<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1">
    <title th:if="${a eq 1}">添加销售订单</title>
    <title th:each="saleOrder:${saleOrder}">修改销售订单</title>
    <link rel="shortcut icon" th:href="@{/pages/logo-1.ico}" href="../static/pages/logo-1.ico"/>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" href="../static/layui/css/layui.css">
    <link rel="stylesheet" th:href="@{/layui/css/admin.css}" href="../static/layui/css/admin.css">
    <link rel="stylesheet" th:href="@{/layui/css/log.css}" href="../static/layui/css/log.css">
</head>
<body>
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
    <div class="layadmin-user-login-main">
        <div th:each="saleOrder:${saleOrder}" class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class=" layadmin-user-login-header">
                <h2>修改销售订单</h2>
            </div>

            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input th:value="${saleOrder.id}" type="text" readonly name="id" id="id" lay-verify="required" placeholder="修改订单ID" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input th:value="${saleOrder.goodsId}" type="text" name="goodsId" id="goodsId" lay-verify="required" placeholder="商品ID" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input th:value="${saleOrder.customerId}" type="text" name="supplierId" id="customerId" lay-verify="required" placeholder="用户ID" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input th:value="${saleOrder.pay}" type="text" name="name" id="pay" lay-verify="required" placeholder="支付方式" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input th:value="${saleOrder.date}" type="text" class="layui-input" id="date" placeholder="时间">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input th:value="${saleOrder.count}"  type="text" name="count" id="count" lay-verify="required" placeholder="数量" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input th:value="${saleOrder.total}"  type="text" name="space" id="total" lay-verify="required" placeholder="总金额" class="layui-input">
            </div>
            <div class="layui-form-item">
                <select name="modules" id="flag" lay-verify="required" lay-search="">
                    <option value="">是否已出库</option>
                    <option value="未出库">未出库</option>
                    <option value="已出库">已出库</option>
                </select>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit" onclick="submit();" id="addpurlog">确认</button>
            </div>
            <div class="layui-form-item">
                <a href="javascript:history.go(-1);" lay-filter="LAY-user-login-submit" class="layui-btn layui-btn-fluid"  id="out">取消</a>
            </div>
        </div>

        <div th:if="${a eq 1}" class=" layadmin-user-login-header">
            <h2>添加销售订单</h2>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input type="text" name="goodsId" id="goodsId" lay-verify="required" placeholder="商品ID" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input type="text" name="id" id="customerId" lay-verify="required" placeholder="客户ID" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input type="text" name="name" id="pay" lay-verify="required" placeholder="支付方式" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input type="text" class="layui-input" id="date" placeholder="时间">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input type="text" name="space" id="count" lay-verify="required" placeholder="数量" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-edit"></label>
                <input type="text" name="space" id="total" lay-verify="required" placeholder="总金额" class="layui-input">
            </div>
            <div class="layui-form-item">
                <select name="modules" id="flag" lay-verify="required" lay-search="">
                    <option value="">是否已出库</option>
                    <option value="未出库">未出库</option>
                    <option value="已出库">已出库</option>
                </select>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit" onclick="submit();" id="addpurlog">确认</button>
            </div>
            <div class="layui-form-item">
                <a href="javascript:history.go(-1);" lay-filter="LAY-user-login-submit" class="layui-btn layui-btn-fluid"  id="out">取消</a>
            </div>
        </div>
    </div>
</div>

<script src="../static/layui/layui.js" th:src="@{/layui/layui.js}" type="text/javascript"></script>
<script src="../static/layui/data.js" th:src="@{/layui/data.js}"></script>
<script src="../static/js/vue.min.js" th:src="@{/js/vue.min.js}" type="text/javascript"></script>
<script src="../static/js/jquery-3.6.3.min.js" th:src="@{/js/jquery-3.6.3.min.js}" type="text/javascript"></script>
<script th:inline="javascript">
    //Javascript代码区域
    //Javascript代码区域
    // window.onload=function() {
    //     let user = [[${user}]];
    //     if (user == null || user == 0) {
    //         window.location.href = "/";
    //     }
    // }

    function submit(){
        let id = $('#id').val()
        let goodsId = $('#goodsId').val()
        let customerId = $('#customerId').val()
        let pay = $('#pay').val()
        let date = $('#date').val()
        let total = $('#total').val()
        let flag = $('#flag').val()
        let count = $('#count').val()
        $.ajax({
            url:"/sale/addxsddzc",
            data:{
                id:id,
                goodsId:goodsId,
                customerId:customerId,
                pay:pay,
                date:date,
                total:total,
                flag:flag,
                count:count
            },
            type:"post",
            dataType :"json",
            // cache : false,
            // async : false,//设置同步（ajax请求此处需求为跳转而不是局部页面刷新）
            success:function (xsddadd){
                if (xsddadd==100) {
                    window.location.href = "/sale/salexsdd";
                }else if (xsddadd==200) {
                    layer.open({
                        title: ''
                        , content: '系统错误,请联系管理员!'
                    });
                }
            }
        })
    }

</script>
</body>
</html>
